﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace VCDepend.Console
{
  public class ExceptionParser
  {
    public static int GetReturnCode(Exception e)
    {
      if (e is RequiredArgsException)
        return 1;

      return Marshal.GetHRForException(e);
    }

    public static string GetErrorMessage(Exception e)
    {
      if (e is RequiredArgsException)
        return ProgramInfo.UsageInstructions;

      return string.Format("ERROR: {0}", e.Message);
    }
  }
}
